# !/usr/bin/env python
# -*-coding:utf-8 -*-
from rest_framework import serializers

from apps.users.models import User


class UserModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = ["id", "username", "password", "avatar", "signature", "introduction", "email"]
        extra_kwargs = {
            "password": {"write_only": True, "required": False}
        }

    def create(self, validated_data):
        return User.objects.create_user(**validated_data)



